<cfcomponent extends="queries">
    
	<!--- Employee Step Detail --->
    <cffunction name="funcGetStepDetail" returntype="query">
        
        <cfquery datasource="#Session.DataSource#" name="qryGetStepDetail">
			<!---scf_GetStepDetail - old scott store procedure--->
            SELECT * 
            FROM Steps 
            Where AssignedDeptID is not null And OrderNo < 100 
            Order by OrderNo
		</cfquery>
        
    	<cfreturn qryGetStepDetail />
    </cffunction>
    <!--- Employee Step Detail --->
    
    
    
    <!--- Employee Step Detail Termination--->
    <cffunction name="funcGetStepDetailTermination" returntype="query">
        
        <cfquery datasource="#Session.DataSource#" name="qryGetStepDetailTermination">
			Select 
            	* 
            from 
            	Steps 
            Where 
            	AssignedDeptID is not null And OrderNo >= 100 
            Order by 
            	OrderNo
		</cfquery>
        
    	<cfreturn qryGetStepDetailTermination />
    </cffunction>
    <!--- Employee Step Detail Termination--->
    
    
    
    <!--- SCF Employee Step Waiting --->
    <cffunction name="funcGetSCFStepWaiting" returntype="query">
    	<cfargument default="" name="StepID" type="numeric" required="no" />
        
        <cfquery datasource="#Session.DataSource#" name="qryGetSCFStepWaiting">
			<!---scf_GetWaiting #ID# - old scott store procedure--->
            Select A.ID, Name = 
					CASE 
						WHEN PreferredName='' OR PreferredName is NULL THEN (Last + ', ' + First)
						ELSE (Last + ', ' + PreferredName)
					END

				From Employee E
					Inner Join StepActions A On E.ID = A.EmployeeID
				Where StepID =  <cfqueryparam value="#ARGUMENTS.StepID#" cfsqltype="cf_sql_integer" />  and ActTimeStamp is Null and NonSCFTypeID is NULL
                
		</cfquery>
        
    	<cfreturn qryGetSCFStepWaiting />
    </cffunction>
    <!--- SCF Employee Step Waiting --->
    
    
    
    <!--- NON SCF Employee Step Waiting --->
    <cffunction name="funcGetNONSCFStepWaiting" returntype="query">
    	<cfargument default="" name="StepID" type="numeric" />
        
        <cfquery datasource="#Session.DataSource#" name="qryGetNONSCFStepWaiting">
			<!---scf_GetWaiting #ID#, 0 - old scott store procedure--->          
            Select A.ID, Name = 
					CASE 
						WHEN PreferredName='' OR PreferredName is NULL THEN (Last + ', ' + First)
						ELSE (Last + ', ' + PreferredName)
					END

				From Employee E
					Inner Join StepActions A On E.ID = A.EmployeeID
				Where StepID =  <cfqueryparam value="#ARGUMENTS.StepID#" cfsqltype="cf_sql_integer" />  and ActTimeStamp is Null and NonSCFTypeID is not NULL
		</cfquery>
        
    	<cfreturn qryGetNONSCFStepWaiting />
    </cffunction>
    <!--- NON SCF Employee Step Waiting --->
    
        
    
    
    <!--- SCF Employee Step Waiting Termination --->
    <cffunction name="funcGetTerminationSCFStepWaiting" returntype="query">
    	<cfargument default="" name="StepID" type="numeric" required="no" />
        
        <cfquery datasource="#Session.DataSource#" name="qryGetTerminationSCFStepWaiting">
            <!--- scf_GetWaitingWithTerm #ARGUMENTS.StepID#, 0, 1 --->
			Select 
            	TermReqID, T.RosettaID, TermDate, SysTermDate, CreationTimeStamp
			From 
            	StepActions A Inner Join 
                TerminationRequests T on A.TermReqID = T.ID Inner Join 
                Rosetta.RosettaStone R on R.RosettaID = T.RosettaID Left Join 
                Rosetta.NonSCFMaster N on R.NonSCFMasterID = N.ID
			Where 
            	StepID = <cfqueryparam value="#ARGUMENTS.StepID#" cfsqltype="cf_sql_integer" /> and ActTimeStamp is Null and (TypeID not in (1,7) or TypeID is NULL)
			Order by 
            	TermReqID                
		</cfquery>
        
    	<cfreturn qryGetTerminationSCFStepWaiting />
    </cffunction>
    <!--- SCF Employee Step Waiting Termination --->
    
    
    
    
    <!--- NON SCF Employee Step Waiting Termination --->
    <cffunction name="funcGetTerminationNonSCFStepWaiting" returntype="query">
    	<cfargument default="" name="StepID" type="numeric" required="no" />
        
        <cfquery datasource="#Session.DataSource#" name="qryGetTerminationNonSCFStepWaiting">
			Select 
            	TermReqID, T.RosettaID, TermDate, SysTermDate, CreationTimeStamp, N.*
			From 
            	StepActions A Inner Join 
                TerminationRequests T on A.TermReqID = T.ID Inner Join 
                Rosetta.RosettaStone R on R.RosettaID = T.RosettaID Left Join 
                Rosetta.NonSCFMaster N on R.NonSCFMasterID = N.ID
            Where 
            	StepID = <cfqueryparam value="#ARGUMENTS.StepID#" cfsqltype="cf_sql_integer" /> and ActTimeStamp is Null and TypeID in (1,7)
			Order by 
            	TermReqID                
		</cfquery>
        
    	<cfreturn qryGetTerminationNonSCFStepWaiting />
    </cffunction>
    <!--- NON SCF Employee Step Waiting Termination --->

    
       
</cfcomponent>